from django.utils.deprecation import MiddlewareMixin

class Test1MiddleWare(MiddlewareMixin):

    def process_request(self,request):

        print("请求前执行11")


    def process_response(self,request,response):
        # 视图已经处理了响应
        # 还没有给浏览器
        print("响应前执行1111")

        return response

class Test2MiddleWare(MiddlewareMixin):

    def process_request(self, request):
        print("请求前执行22")


    def process_response(self,request,response):
        # 视图已经处理了响应
        # 还没有给浏览器
        print("响应前执行222")

        return response